Skip to content

feat(openinfer): add OpenInfer as an OpenAI-compatible provider - #41034

Open
AJ-ing wants to merge 2 commits into
BerriAI:mainfrom
AJ-ing:feat-openinfer-provider
Open

AJ-ing wants to merge 2 commits into
BerriAI:mainfrom
AJ-ing:feat-openinfer-provider

Conversation

@AJ-ing

@AJ-ing AJ-ing commented Sep 14, 2026 •

Copy link
Copy Markdown

TLDR

Problem this solves:

  • OpenInfer is not a native LiteLLM provider
  • Users have to fake it as a generic OpenAI-compatible endpoint
  • Spend tracking has no OpenInfer catalog rates

How it solves it:

  • Registers openinfer as a JSON OpenAI-compatible provider
  • Routes openinfer/<model> to https://api.openinfer.ai/v1
  • Stores vendor $/1M rates as per-token catalog prices

User Flow

Before: a developer who wants OpenInfer through LiteLLM has no native provider, so the call never reaches https://api.openinfer.ai/v1

  1. They set OPENINFER_API_KEY and send POST https://litellm-domain/v1/chat/completions with "model": "openinfer/@oi/Llama-3.2-1B-Instruct"
  2. LiteLLM does not resolve openinfer as a provider
  3. The request never hits https://api.openinfer.ai/v1/chat/completions

After: the same request routes to OpenInfer's chat completions endpoint with the catalog model id and list price

  1. They set OPENINFER_API_KEY and send POST https://litellm-domain/v1/chat/completions with "model": "openinfer/@oi/Llama-3.2-1B-Instruct"
  2. LiteLLM strips the openinfer/ prefix and uses https://api.openinfer.ai/v1
  3. The upstream call is POST https://api.openinfer.ai/v1/chat/completions with "model": "@oi/Llama-3.2-1B-Instruct"

Relevant issues

Closes #34357
Replaces #34623, which GitHub closed when litellm_internal_staging was deleted and recreated. The provider code never landed on main or staging

Companion docs: BerriAI/litellm-docs#905

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/llms/openai_like/test_openinfer_provider.py -v (12 passed; catalog test no longer pins vendor rates)
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

No OPENINFER_API_KEY in this environment, so this is routing proof only. Live chat completions against the vendor still need a key

Before (ed4caeb)

  1. python3 -c 'import json; print("openinfer" in json.load(open("litellm/llms/openai_like/providers.json")))'
  2. Observed: False. main also has no LlmProviders.OPENINFER enum

After (rebased tip)

  1. python3 - <<'PY' from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider model, provider, api_key, api_base = get_llm_provider( model="openinfer/@oi/Llama-3.2-1B-Instruct", custom_llm_provider=None, api_base=None, api_key="sk-test", ) print(f"model={model}") print(f"provider={provider}") print(f"api_base={api_base}") PY
  2. Observed:
model=@oi/Llama-3.2-1B-Instruct
provider=openinfer
api_base=https://api.openinfer.ai/v1

Type

New Feature

Caveats (if any)

Medium

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@codspeed

codspeed Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing AJ-ing:feat-openinfer-provider (2b67e89) with main (6f5ca84)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds OpenInfer as a new LLM provider.

The PR appears safe to merge; no outstanding findings remain.

Summary

The PR registers OpenInfer as an OpenAI-compatible chat provider and adds model pricing and capability data.

  • Adds the provider route, credentials, endpoint declarations, and proxy creation fields.
  • Adds tests for routing, request configuration, and catalog consistency.

Reviews (6) · Last reviewed commit: "fix(openinfer): assert catalog invariant..."

Comment thread litellm/constants.py Outdated
Comment thread tests/test_litellm/llms/openai_like/test_openinfer_provider.py
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AJ-ing

AJ-ing commented Sep 15, 2026

Copy link
Copy Markdown
Author

Rebased onto latest litellm_internal_staging and dropped the constants.py comment Greptile flagged. Also pinned the outgoing chat request contract in the provider tests. @greptileai

@onkarbpatil

Copy link
Copy Markdown

@AJ-ing what else is left to get this reviewed and merged?

@AJ-ing
AJ-ing force-pushed the feat-openinfer-provider branch from b6414df to 907d359 Compare September 16, 2026 01:06
@AJ-ing

AJ-ing commented Sep 16, 2026

Copy link
Copy Markdown
Author

@onkarbpatil Just rebased onto latest litellm_internal_staging again (ahead 7 / behind 0).

What's left for merge is maintainer review. I don't have merge access.

Status:

  • Greptile 5/5, Veria clean, provider tests green
  • Companion docs still open: docs(openinfer): add OpenInfer provider page litellm-docs#905 (helps the documentation/env-var scan stay green)
  • The only red check on this PR is Vertex AI / Run tests, and that same job is also red on staging itself (gemini embeddings cost asserts). Not from the OpenInfer changes

@mateo-berri when you have a minute, this one and the docs PR are ready for a look

@onkarbpatil

Copy link
Copy Markdown

@AJ-ing @mateo-berri any update on review?

@AJ-ing

AJ-ing commented Sep 19, 2026

Copy link
Copy Markdown
Author

@onkarbpatil No new code changes. Branch is current with staging, Greptile 5/5. Still needs @mateo-berri review; docs companion is BerriAI/litellm-docs#905.

@onkarbpatil

Copy link
Copy Markdown

@mateo-berri ?

@devin-ai-integration
devin-ai-integration Bot changed the base branch from litellm_internal_staging to main September 23, 2026 14:34
@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 23, 2026 14:34
@chongyihu

Copy link
Copy Markdown

@mateo-berri @ryan-crabbe-berri @yuneng-berri @kerry-berri
Sorry for the repeated pings! Could you help us get this reviewed and approved? Let me know if anything's missing or if there's anything I can do to help move it along.

@BerriAI BerriAI deleted a comment from devin-ai-integration Bot Sep 30, 2026
@AJ-ing
AJ-ing force-pushed the feat-openinfer-provider branch from 907d359 to 64be726 Compare October 1, 2026 00:05
@AJ-ing

AJ-ing commented Oct 1, 2026

Copy link
Copy Markdown
Author

@onkarbpatil @chongyihu Rebased onto latest main after staging was deleted (conflicts cleared; PR is MERGEABLE again). Tip is 64be726. Provider unit tests: 12 passed. Waiting on maintainer review / CI. @greptileai

Comment thread tests/unit/llms/openai_like/test_openinfer_provider.py Outdated
@AJ-ing

AJ-ing commented Oct 1, 2026

Copy link
Copy Markdown
Author

Pushed 7d016c9: catalog unit test now checks backup agreement and positive rates instead of pinning vendor $/token (Greptile P2).

Remaining red checks look like main noise, not OpenInfer: CLICKHOUSE_FLUSH_INTERVAL_SECONDS docs scan, osv lockfile CVEs, interactions OpenAPI tests, batches metadata asserts, proxy-behavior postgres role. Re-requesting review. @greptileai

@chongyihu

Copy link
Copy Markdown

Hi @AJ-ing , seems like there are still upstream CI issues. Is the upstream resolved? If it is resolved, can you hep us rebase and rerun the CI test? If it is not, is it possible that you guys can manually approve and merge the openinfer integration? It would be very helpful!

@AJ-ing
AJ-ing force-pushed the feat-openinfer-provider branch from 7d016c9 to ed7917d Compare October 2, 2026 05:34
@AJ-ing

AJ-ing commented Oct 2, 2026

Copy link
Copy Markdown
Author

@chongyihu Rebased onto latest main (tip ed7917d). OpenInfer unit tests still 12/12. CI should re-run now; mergeability should clear once checks finish.

@AJ-ing

AJ-ing commented Oct 2, 2026

Copy link
Copy Markdown
Author

@greptileai Rebased onto latest main. Please re-review the tip.

AJ-ing and others added 2 commits October 6, 2026 12:31
Register OpenInfer in the JSON provider registry with catalog models,
proxy create fields, and unit coverage so requests route via openinfer/

Co-authored-by: Cursor <cursoragent@cursor.com>
Pinning per-token prices made CI fail when the vendor list changed. Keep
the backup agreement and positivity checks our code owns.

Co-authored-by: Cursor <cursoragent@cursor.com>
@AJ-ing
AJ-ing force-pushed the feat-openinfer-provider branch from ed7917d to 2b67e89 Compare October 6, 2026 01:32
@AJ-ing

AJ-ing commented Oct 6, 2026

Copy link
Copy Markdown
Author

@kerry-berri Rebased onto latest main (tip 2b67e89). OpenInfer unit tests still 12/12. Ready for your approval.

@AJ-ing

AJ-ing commented Oct 6, 2026

Copy link
Copy Markdown
Author

@greptileai Tip rebased onto latest main. Please re-review.

@AJ-ing

AJ-ing commented Oct 6, 2026

Copy link
Copy Markdown
Author

@kerry-berri Both remaining reds are also failing on current main (not OpenInfer):

  • misc: test_seed_tracing_fixtures fixture hash / bulk-export (same on main run 37399367833)
  • proxy-infra-root: test_component_allowlists missing /v1/logs allowlist (same on main)

OpenInfer unit tests are green (12/12). Diff only touches provider registry / catalog / our test file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]:Add OpenInfer Provider

3 participants